<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        console.log(111);
        setTimeout(()=>{
            console.log(222);
        })
        console.log(333);
        setTimeout(()=>{
            console.log(444);
        })





        function fn1(cb){
            setTimeout(()=>{
                console.log("fn1");
                cb();
            },1000);
        }
        function fn2(cb){
            setTimeout(()=>{
                console.log("fn2");
                cb();
            },1000);
        }
        function fn3(cb){
            setTimeout(()=>{
                console.log("fn3");
                cb();
            },1000);
        }

    // 回调地狱
    fn1(function(){
        console.log("fn1执行完毕");
        fn2(function(){
            console.log("fn2执行完毕");
            fn3(function(){
                console.log("fn3执行完毕");
            })
        })
    })

    </script>
</body>
</html>